import request from "@/plugins/request"
// 修改密码
export const changePassword = (data) => {
  return request({
    url: "app-api/member/user/update-password",
    method: "put",
    data,
  })
}

// 获取国家列表
export const getCountryList = () => {
  return request({
    url: "app-api/product/productCountry/list",
    method: "get",
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return request(
    {
      url: "app-api/member/user/get",
      method: "get",
    },
    {
      showError: false,
    },
  )
}
// 基本资料
export const getBaseInfo = () => {
  return request(
    {
      url: "app-api/member/user/getDetail",
      method: "get",
    },
    {},
  )
}
// 修改基本资料
export const updateBaseInfo = (data) => {
  return request({
    url: "app-api/member/user/update",
    method: "put",
    data,
  })
}

// 获取地址
export const getAddresses = () => {
  return request({
    url: "app-api/member/address/list",
    method: "get",
  })
}
// 获取地址详情
export const getAddressDetail = (params) => {
  return request({
    url: "app-api/member/address/get",
    method: "get",
    params,
  })
}
// 添加地址
export const addAddress = (data) => {
  return request({
    url: "app-api/member/address/create",
    method: "post",
    data,
  })
}
// 修改地址
export const updateAddress = (data) => {
  return request({
    url: "app-api/member/address/update",
    method: "put",
    data,
  })
}
// 删除地址
export const deleteAddress = (data) => {
  return request({
    url: "app-api/member/address/delete",
    method: "get",
    params: data,
  })
}

// 获取银行列表
export const getBankList = () => {
  return request({
    url: "app-api/member/bank/list",
    method: "get",
  })
}
// 获取地址详情
export const getBankDetail = (params) => {
  return request({
    url: "app-api/member/bank/get",
    method: "get",
    params,
  })
}

// 添加银行
export const addBank = (data) => {
  return request({
    url: "app-api/member/bank/create",
    method: "post",
    data,
  })
}
// 修改银行
export const updateBank = (data) => {
  return request({
    url: "app-api/member/bank/update",
    method: "put",
    data,
  })
}
// 删除银行
export const deleteBank = (data) => {
  return request({
    url: "app-api/member/bank/delete",
    method: "get",
    params: data,
  })
}

// 获取用户徽章信息
export const getUserBadges = () => {
  return request({
    url: "app-api/member/badge/info",
    method: "get",
  })
}
